#!/usr/bin/python 
def is_prime(n):
	for i in xrange(2, int(n**0.5) + 1):
		if n % i == 0:
			return False
	return True

array = []
sum = 1
for num in xrange(2,2000001):
	if is_prime(num):
		sum += num
print sum
